package service;

import javax.jms.JMSException;

import newspaper.VnexpressURL;

import entity.News;

import model.NewsModel;

public class VnexpressMessageSeller extends Thread {

	public void run() {
		NewsModel newsModel = new NewsModel();
		News news = null;
		while (true) {
			news = newsModel.getFalseComplete();
			try {
				if (news == null) {					
					System.out.println("Waiting for get new url !");
					Thread.currentThread();
					Thread.sleep(20 * 1000);
				} else {
					ActiveMQService.sendContentSMS(news.getUrl()); 
					Thread.currentThread();
					Thread.sleep(4 * 1000);
					System.out.println("Send message ok !");
				}
			} catch (JMSException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
